package com.rk.kbk.model;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.rk.kbk.common.DateJsonDeserializer;
import com.rk.kbk.common.DateJsonSerializer;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @Address
 * @地址(address)
 * @version : Ver 1.0
 */
@Entity
public class Address implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * @备注:主键(地址表)
	 * @字段:id INT(10)
	 */
	@Id
	@GeneratedValue(strategy= GenerationType.IDENTITY)
	@GenericGenerator(name="auto-identity",strategy="identity")
	@Column(updatable = false, columnDefinition="INT(10) COMMENT '主键(地址表)'")
	private java.lang.Long id;

	/**
	 * @备注:真实姓名
	 * @字段:real_name VARCHAR(33)
	 */
	@Column(columnDefinition="VARCHAR(33) COMMENT '真实姓名'")
	private java.lang.String realName;

	/**
	 * @备注:电话号码
	 * @字段:phone VARCHAR(33)
	 */
	@Column(columnDefinition="VARCHAR(33) COMMENT '电话号码'")
	private java.lang.String phone;

	/**
	 * @备注:性别
	 * @字段:sex VARCHAR(20)
	 */
	@Column(columnDefinition="VARCHAR(20) COMMENT '性别'")
	private java.lang.String sex;

	/**
	 * @备注:省
	 * @字段:province VARCHAR(30)
	 */
	@Column(columnDefinition="VARCHAR(30) COMMENT '省'")
	private java.lang.String province;

	/**
	 * @备注:市
	 * @字段:city VARCHAR(30)
	 */
	@Column(columnDefinition="VARCHAR(30) COMMENT '市'")
	private java.lang.String city;

	/**
	 * @备注:区
	 * @字段:county VARCHAR(30)
	 */
	@Column(columnDefinition="VARCHAR(30) COMMENT '区'")
	private java.lang.String county;

	/**
	 * @备注:详细地址
	 * @字段:address_detail VARCHAR(300)
	 */
	@Column(columnDefinition="VARCHAR(300) COMMENT '详细地址'")
	private java.lang.String addressDetail;

	/**
	 * @备注:邮编
	 * @字段:zip_code VARCHAR(33)
	 */
	@Column(columnDefinition="VARCHAR(33) COMMENT '邮编'")
	private java.lang.String zipCode;

	/**
	 * @备注:等级，默认0表示非默认地址，1表示默认地址
	 * @字段:level INT(10)
	 */
	@Column(columnDefinition="INT(10) COMMENT '等级，默认0表示非默认地址，1表示默认地址'")
	private java.lang.Integer level;

	/**
	 * @备注:经度
	 * @字段:lng VARCHAR(66)
	 */
	@Column(columnDefinition="VARCHAR(66) COMMENT '经度'")
	private java.lang.String lng;

	/**
	 * @备注:纬度
	 * @字段:lat VARCHAR(33)
	 */
	@Column(columnDefinition="VARCHAR(33) COMMENT '纬度'")
	private java.lang.String lat;

	/**
	 * @备注:地址类型:1表示用户地址,2表示商家地址,3表示装备商城配货地址
	 * @字段:type VARCHAR(33)
	 */
	@Column(columnDefinition="VARCHAR(33) COMMENT '地址类型:1表示用户地址,2表示商家地址,3表示装备商城配货地址'")
	private java.lang.Integer type;

	/**
	 * @备注:状态，1表示正常，2表示废弃
	 * @字段:status INT(10)
	 */
	@Column(columnDefinition="INT(10) COMMENT '状态，1表示正常，2表示废弃'")
	private java.lang.Integer status;



	/**
	 * @备注:区域代码
	 * @字段:status INT(10)
	 */
	@Column(columnDefinition="VARCHAR(10) COMMENT '区域代码'")
	private java.lang.String areaCode;

	/**
	 * @备注:创建时间
	 * @字段:gmt_datetime DATETIME(19)
	 */
	@Column(updatable = false, columnDefinition="DATETIME(19) COMMENT '创建时间'")
	@JsonSerialize(using=DateJsonSerializer.class)
	@JsonDeserialize(using=DateJsonDeserializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss" )
	private java.util.Date gmtDatetime = new java.util.Date();

	/**
	 * @备注:修改时间
	 * @字段:upt_datetime DATETIME(19)
	 */
	@Column(columnDefinition="DATETIME(19) COMMENT '修改时间'")
	@JsonSerialize(using=DateJsonSerializer.class)
	@JsonDeserialize(using=DateJsonDeserializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss" )
	private java.util.Date uptDatetime = new java.util.Date();

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (!(o instanceof Address)) return false;
		Address address = (Address) o;
		if (!realName.equals(address.realName)) return false;
		if (!phone.equals(address.phone)) return false;
		if (!sex.equals(address.sex)) return false;
		if (!province.equals(address.province)) return false;
		if (!city.equals(address.city)) return false;
		if (!county.equals(address.county)) return false;
		return addressDetail.equals(address.addressDetail);
	}


	public Address(){
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setRealName(java.lang.String realName) {
		this.realName = realName;
	}

	public java.lang.String getRealName() {
		return this.realName;
	}


	public void setPhone(java.lang.String phone) {
		this.phone = phone;
	}

	public java.lang.String getPhone() {
		return this.phone;
	}


	public void setSex(java.lang.String sex) {
		this.sex = sex;
	}

	public java.lang.String getSex() {
		return this.sex;
	}


	public void setProvince(java.lang.String province) {
		this.province = province;
	}

	public java.lang.String getProvince() {
		return this.province;
	}


	public void setCity(java.lang.String city) {
		this.city = city;
	}

	public java.lang.String getCity() {
		return this.city;
	}


	public void setCounty(java.lang.String county) {
		this.county = county;
	}

	public java.lang.String getCounty() {
		return this.county;
	}


	public void setAddressDetail(java.lang.String addressDetail) {
		this.addressDetail = addressDetail;
	}

	public java.lang.String getAddressDetail() {
		return this.addressDetail;
	}

	public String getAreaCode() {
		return areaCode;
	}

	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}

	public void setZipCode(java.lang.String zipCode) {
		this.zipCode = zipCode;
	}

	public java.lang.String getZipCode() {
		return this.zipCode;
	}


	public void setLevel(java.lang.Integer level) {
		this.level = level;
	}

	public java.lang.Integer getLevel() {
		return this.level;
	}


	public void setLng(java.lang.String lng) {
		this.lng = lng;
	}

	public java.lang.String getLng() {
		return this.lng;
	}


	public void setLat(java.lang.String lat) {
		this.lat = lat;
	}

	public java.lang.String getLat() {
		return this.lat;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public void setStatus(java.lang.Integer status) {
		this.status = status;
	}

	public java.lang.Integer getStatus() {
		return this.status;
	}


	public void setGmtDatetime(java.util.Date gmtDatetime) {
		this.gmtDatetime = gmtDatetime;
	}

	public java.util.Date getGmtDatetime() {
		return this.gmtDatetime;
	}


	public void setUptDatetime(java.util.Date uptDatetime) {
		this.uptDatetime = uptDatetime;
	}

	public java.util.Date getUptDatetime() {
		return this.uptDatetime;
	}
}
